package com.rongc.client.freight.business.mine.view.adapter;

import android.content.Context;

import com.rongc.client.freight.R;
import com.rongc.client.freight.base.view.adapter.RecyclerBaseAdapter;
import com.rongc.client.freight.business.mine.model.ScoreBean;

import java.util.List;

/**
 * Created by ccqx on 2017/6/28.
 */

public class RecyclerScoreAdapter extends RecyclerBaseAdapter<ScoreBean>{


    public RecyclerScoreAdapter(Context mContext, List<ScoreBean> mDatas) {
        super(mContext, mDatas);
    }

    @Override
    protected void onBind(final BaseRecyclerViewHolder holder, int position, ScoreBean data) {
        if("1".equals(data.getType())){
            holder.setText(R.id.tv_account,String.format(mContext.getResources().getString(R.string.score_add_lable),data.getNumber()));
            holder.setTextColor(R.id.tv_account,mContext.getResources().getColor(R.color.universal_text_error));
        }else{
            holder.setText(R.id.tv_account,String.format(mContext.getResources().getString(R.string.score_remove_lable),data.getNumber()));
            holder.setTextColor(R.id.tv_account,mContext.getResources().getColor(R.color.universal_text_pay));
        }
        holder.setText(R.id.tv_score,String.format(mContext.getResources().getString(R.string.score_sy_lable),data.getScore()));
        holder.setText(R.id.tv_detail,data.getDetail());
        holder.setText(R.id.tv_date,data.getDate());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.recycler_score_item;
    }
}
